<?php
// +-------------------------------------------------------------------
// |
// +-------------------------------------------------------------------
// | Copyright (c) 2009-2016 All rights reserved.
// +-------------------------------------------------------------------
namespace Service\Api\V1;

class UserCollectCancelOne
{
    public $login = true; //是否需要登录才能访问该接口
    public $title = "资讯或者帖子收藏取消ok";
    public $group = '收藏';
    public $desc = "";

    public $input = [
        'relate_id' => 'required;int;label=关联id;',
        'type' => 'label=类型;comment=类型： 0园区资讯 1帖子 2政务资讯',
    ];

    public $output = [
    ];

    public function run($param, $uid)
    {
        $collect = M('user_collect')->where(['relate_id' => $param['relate_id'], 'type' => $param['type']])
            ->delete();
        if($collect){
            return [];
        }else{
           throw new \Exception('取消失败');
        }

    }
}
